package com.module.shici.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.fenghuajueli.libbasecoreui.utils.MyStatusBarUtils;
import com.module.shici.R;
import com.module.shici.adapter.AuthorRvAdapter;
import com.module.shici.data.ShiCIData;

public class AuthorActivity extends AppCompatActivity {

    private RecyclerView rv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        MyStatusBarUtils.setStatusBar(this,"#F6EEE4");
        setContentView(R.layout.module_shici_activity_author);
        rv = findViewById(R.id.author_rv);
        findViewById(R.id.author_back).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        //绑定布局管理器
        rv.setLayoutManager(new GridLayoutManager(this,3));
        //绑定 adapter
        AuthorRvAdapter authorRvAdapter = new AuthorRvAdapter(ShiCIData.getAuthorArray());
        rv.setAdapter(authorRvAdapter);
        authorRvAdapter.getOnClick(new AuthorRvAdapter.OnItemClickLister() {
            @Override
            public void setOnItemClick(String author) {
                Intent intent = new Intent(AuthorActivity.this,MyShiCiActivity.class);
                intent.putExtra("title",author);
                intent.putExtra("type",2);
                startActivity(intent);
            }
        });
    }
}